package com.atguigu.lease.common.exception;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * @author 杨博超
 * @title LeaseException
 * @create 2025/1/13 9:32
 * @description
 */
@Data
public class LeaseException extends RuntimeException {

    private Integer code;

    public LeaseException() {

    }

    public LeaseException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public LeaseException(ResultCodeEnum result) {
        this(result.getCode(), result.getMessage());
    }

    @Override
    public String toString() {
        return "LeaseException{" +
                "code=" + code +
                "，message=" + getMessage() +
                '}';
    }
}
